class Solution {
public:
    int firstUniqChar(string s) {
        int arr[124] = { 0 };
        int Min = -1;
        int flag = 0;
        for (int i = 0; i < s.size(); i++)
        {
            arr[s[i]]++;

        }
        for (int i = 0; i < s.size(); i++)
        {
            if (arr[s[i]] == 1)
            {
                flag++;
                if (flag == 1)
                    Min = i;
                else
                    Min = min(i, Min);
            }


        }
        return Min;
    }
};